
<template>
  <div id="Goods">
<<<<<<< HEAD
    <div class="account-top" style="float:right ">
=======
    <div class="account-top" style="float: right">
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
      <el-button type="primary" @click="goto('AddGoods')">新增</el-button>
      <el-button type="primary" @click="goto('editGoods')">修改</el-button>
      <el-button type="primary">批量设置</el-button>
      <el-button type="primary">启用</el-button>
<<<<<<< HEAD
=======

      <el-button type="danger">删除</el-button>&nbsp;
      <el-button type="primary" @click="exportData()">导出</el-button>
      &nbsp;
      <el-upload
        style="display: inline-block"
        class="upload-demo"
        action="/erp/goods/read/goods"
        :on-success="isOk"
      >
        <el-button type="primary">导入</el-button>
      </el-upload>
    </div>
    <div class="account-content">
      <el-table
        height="500px"
        :data="list"
        border
        style="width: 100%; font-size: 13px; margin-left: 20px"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" prop="id" width="55">
        </el-table-column>
        <el-table-column prop="goodcode" label="序号" width="200">
        </el-table-column>
        <el-table-column prop="imagename" label="图片" width="150">
        </el-table-column>
        <el-table-column prop="barcode" label="商品编号" width="120">
        </el-table-column>
        <el-table-column prop="goodcode" label="商品条码" width="120">
        </el-table-column>
        <el-table-column prop="goodname" label="商品名称" width="120">
        </el-table-column>
        <el-table-column prop="accountType" label="辅助属性" width="200">
        </el-table-column>
        <el-table-column prop="categoryName" label="商品类别" width="200">
        </el-table-column>
        <el-table-column prop="specificationmodel" label="规格型号" width="200">
        </el-table-column>
        <el-table-column prop="suppliercode" label="默认供应商" width="200">
        </el-table-column>
        <el-table-column prop="brandName" label="品牌" width="200">
        </el-table-column>
        <el-table-column prop="basicUnitName" label="单位" width="200">
        </el-table-column>
        <el-table-column prop="defaultStock" label="首选仓库" width="200">
        </el-table-column>
        <el-table-column prop="currentStock" label="当前库存" width="200">
        </el-table-column>
        <el-table-column prop="initNum" label="期初数量" width="200">
        </el-table-column>
        <el-table-column prop="unitCost" label="单位成本" width="200">
        </el-table-column>
        <el-table-column prop="initPrice" label="期初总价格" width="200">
        </el-table-column>
        <el-table-column prop="retailprice" label="零售价" width="200">
        </el-table-column>
        <el-table-column prop="wholesalePrice" label="批发价" width="200">
        </el-table-column>
        <el-table-column prop="vipprice" label="会员价" width="200">
        </el-table-column>
        <el-table-column prop="createDate" label="创建时间" width="200">
        </el-table-column>
      </el-table>
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
      <el-button type="primary">导入</el-button>
      <el-button type="primary">导出</el-button>
      <el-button type="danger">删除</el-button>
    </div>
    <div class="account-content">
<<<<<<< HEAD
      <el-table height="500px" :data="accounts" border style="width: 100%;font-size: 13px;margin-left: 20px;">
        <el-table-column type="selection" width="55">
        </el-table-column>
=======
      <el-table
        height="500px"
        :data="accounts"
        border
        style="width: 100%; font-size: 13px; margin-left: 20px"
      >
        <el-table-column type="selection" width="55"> </el-table-column>
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
        <el-table-column prop="accountCode" label="序号" width="200">
        </el-table-column>
        <el-table-column prop="presentMoney" label="图片" width="150">
        </el-table-column>
        <el-table-column prop="accountDate" label="商品编号" width="120">
        </el-table-column>
        <el-table-column prop="aTypeId" label="商品名称" width="120">
        </el-table-column>
        <el-table-column prop="isDefault" label="商品标签" width="150">
        </el-table-column>
        <el-table-column prop="accountName" label="商品标签" width="200">
        </el-table-column>
        <el-table-column prop="accountType" label="辅助属性" width="200">
        </el-table-column>
        <el-table-column prop="category" label="商品类别" width="200">
        </el-table-column>
        <el-table-column prop="specification" label="规格型号" width="200">
        </el-table-column>
        <el-table-column prop="defaultSupplier" label="默认供应商" width="200">
        </el-table-column>
        <el-table-column prop="brand" label="品牌" width="200">
        </el-table-column>
        <el-table-column prop="unit" label="单位" width="200">
        </el-table-column>
        <el-table-column prop="preferredWarehouse" label="首选仓库" width="200">
        </el-table-column>
        <el-table-column prop="currentStock" label="当前库存" width="200">
        </el-table-column>
        <el-table-column prop="initialQuantity" label="期初数量" width="200">
        </el-table-column>
        <el-table-column prop="unitCost" label="单位成本" width="200">
        </el-table-column>
        <el-table-column prop="initialTotalPrice" label="期初总价" width="200">
        </el-table-column>
<<<<<<< HEAD
        <el-table-column prop="estimatedPurchasePrice" label="预计采购价" width="200">
        </el-table-column>
        <el-table-column prop="highestPurchasePrice" label="最高采购价" width="200">
        </el-table-column>
        <el-table-column prop="lowestSellingPrice" label="最低销售价" width="200">
=======
        <el-table-column
          prop="estimatedPurchasePrice"
          label="预计采购价"
          width="200"
        >
        </el-table-column>
        <el-table-column
          prop="highestPurchasePrice"
          label="最高采购价"
          width="200"
        >
        </el-table-column>
        <el-table-column
          prop="lowestSellingPrice"
          label="最低销售价"
          width="200"
        >
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
        </el-table-column>
        <el-table-column prop="retailPrice" label="零售价" width="200">
        </el-table-column>
        <el-table-column prop="wholesalePrice" label="批发价" width="200">
        </el-table-column>
        <el-table-column prop="memberPrice" label="会员价" width="200">
        </el-table-column>
        <el-table-column prop="creationTime" label="创建时间" width="200">
        </el-table-column>
        <el-table-column prop="remarks" label="备注" width="200">
        </el-table-column>
        <el-table-column prop="status" label="状态" width="120">
          <template slot-scope="scope">
<<<<<<< HEAD
            <el-switch v-model="scope.row.status" active-color="#66b1ff" inactive-color="#c1c1c1" active-value="1"
              inactive-value="0">
=======
            <el-switch
              v-model="scope.row.status"
              active-color="#66b1ff"
              inactive-color="#c1c1c1"
              active-value="1"
              inactive-value="0"
            ></el-switch>
            <el-switch
              v-model="scope.row.status"
              active-color="#66b1ff"
              inactive-color="#c1c1c1"
              active-value="1"
              inactive-value="0"
            >
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
            </el-switch>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="100">
          <template slot-scope="scope">
<<<<<<< HEAD
            <el-button @click="handleClick(scope.row)" type="text" size="small">查看</el-button>
=======
            <el-button @click="handleClick(scope.row)" type="text" size="small"
              >查看</el-button
            >
            <el-button @click="handleClick(scope.row)" type="text" size="small"
              >查看</el-button
            >
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
            <el-button type="text" size="small">编辑</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>
<<<<<<< HEAD
    <el-pagination style="position: relative;left: 700px;bottom: 30px;" @size-change="handleSizeChange"
      @current-change="handleCurrentChange" :current-page="currentPage4" :page-sizes="[100, 200, 300, 400]"
      :page-size="100" layout="total, sizes, prev, pager, next, jumper" :total="400">
    </el-pagination>
=======
    <el-pagination
      style="position: relative; left: 700px; top: 30px"
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :page-size="pageInfo.pageSize"
      layout="prev, pager, next, jumper"
      :total="pageInfo.total"
    ></el-pagination>
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
  </div>
</template>

<script>
<<<<<<< HEAD
import AddGoods from '@/components/goodComponents/AddGoods.vue';

export default {
  name: 'Goods',
  components: {
    AddGoods
  },
  data() {
    return {
      dialogFormVisible: false,
      //分页参数
      currentPage1: 5,
      currentPage2: 5,
      currentPage3: 5,
      currentPage4: 4,
      accounts: [
        {
          accountCode: 'test1',
          accountName: 'test1',
          presentMoney: '1',
          isDefault: '',
          accountDate: '',
          aTypeId: '',
          status: '1',
          accountType: '', // 新增字段
          category: '', // 新增字段
          specification: '', // 新增字段
          defaultSupplier: '', // 新增字段
          brand: '', // 新增字段
          unit: '', // 新增字段
          preferredWarehouse: '', // 新增字段
          currentStock: '', // 新增字段
          initialQuantity: '', // 新增字段
          unitCost: '', // 新增字段
          initialTotalPrice: '', // 新增字段
          estimatedPurchasePrice: '', // 新增字段
          highestPurchasePrice: '', // 新增字段
          lowestSellingPrice: '', // 新增字段
          retailPrice: '', // 新增字段
          wholesalePrice: '', // 新增字段
          memberPrice: '', // 新增字段
          creationTime: '', // 新增字段
          remarks: '' // 新增字段
        },
        {
          accountCode: 'test2',
          accountName: 'test2',
          presentMoney: '2',
          isDefault: '',
          accountDate: '',
          aTypeId: '',
          status: '1',
          accountType: '', // 新增字段
          category: '', // 新增字段
          specification: '', // 新增字段
          defaultSupplier: '', // 新增字段
          brand: '', // 新增字段
          unit: '', // 新增字段
          preferredWarehouse: '', // 新增字段
          currentStock: '', // 新增字段
          initialQuantity: '', // 新增字段
          unitCost: '', // 新增字段
          initialTotalPrice: '', // 新增字段
          estimatedPurchasePrice: '', // 新增字段
          highestPurchasePrice: '', // 新增字段
          lowestSellingPrice: '', // 新增字段
          retailPrice: '', // 新增字段
          wholesalePrice: '', // 新增字段
          memberPrice: '', // 新增字段
          creationTime: '', // 新增字段
          remarks: '' // 新增字段
        },
      ]
    }
  },
  methods: {
=======
import AddGoods from "@/components/goodComponents/AddGoods.vue";

export default {
  name: "Goods",
  components: {
    AddGoods,
  },
  data() {
    return {
      fileList: [],
      multipleSelection: [],
      brands: [],
      attributes: [],
      units: [],
      stocks: [],
      categorys: [],
      dialogFormVisible: false,
      pageInfo: null,
      list: [],
      allGoods: [],
    };
  },
  methods: {
    isOk(e) {
      console.log(e);
      if (e.code === 200) {
        alert("导入成功!");
      } else {
        alert("导入失败!");
      }
    },
    exportData() {
      var multipleSelection = [];
      if (this.multipleSelection != null) {
        multipleSelection = this.multipleSelection;
        console.log(multipleSelection);
      } else {
        multipleSelection = this.allGoods;
      }
      this.axios({
        headers: {
          "Content-Type": "application/json",
        },
        url: "/erp/goods/export/goods",
        method: "POST",
        data: JSON.stringify(multipleSelection),
      }).then((rs) => {
        if (rs.data.code === 200) {
          let name = rs.data.name;
          alert("导出成功，文件名路径名为：" + name);
        } else {
          alert("导出失败");
        }
      });
    },
    handleSelectionChange(val) {
      this.multipleSelection = val;
    },

    handleSizeChange(val) {
      this.byPage(val);
    },
    handleCurrentChange(val) {
      this.byPage(val);
    },
    byPage(pageNum) {
      this.axios({
        url: "/erp/goods/goods/getList",
        params: {
          pageSize: 5,
          pageNum,
        },
      }).then((rs) => {
        this.pageInfo = rs.data.pageInfo;
        this.list = this.pageInfo.list;
      });
    },
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    goto(routeName) {
      // 使用编程式导航跳转到指定路由
      this.$router.push({ name: routeName });
<<<<<<< HEAD
    }
  }
}
=======
    },
    getAllGoods() {
      this.axios({
        url: "/erp/goods/goods/getAllGoods",
      }).then((rs) => {
        this.allGoods = rs.data.list;
      });
    },
  },
  created() {
    this.getAllGoods();
    this.byPage(1);
  },
};
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
</script>

<style >
#account {
  width: 100%;
  height: 100%;
}

.account-top {
  width: calc(100% -20px);
  height: 60px;
  /* background-color: pink; */
  line-height: 60px;
  padding-left: 20px;
  margin-left: 500px;
  font-size: 13px;
<<<<<<< HEAD

=======
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
}

.account-top h3 {
  display: inline-block;
  margin-right: 1000px;
}

.account-content {
  width: 100%;
  height: calc(100% - 60px);
  /* background-color: skyblue; */
}
<<<<<<< HEAD


=======
>>>>>>> 6be95d2b3200ab6fbb17d1e0a5a9b367f780cc8e
